﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace ExcelFileQueryTool
{
    public sealed class DailyRecordGrid : DataGridView
    {
        protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e)
        {
            base.OnRowPostPaint(e);

            var row = this.Rows[e.RowIndex];

            var isPaidOff = row.Cells[8].Value.ToString() == row.Cells[11].Value.ToString()
                || (Convert.ToInt32(row.Cells[8].Value) == 0 && !string.IsNullOrEmpty(row.Cells[11].Value.ToString()));

            if (isPaidOff)
                row.Cells[1].Style.BackColor = Color.OrangeRed;

            if (row.Cells[13].Value.ToString() == "是")
                row.Cells[2].Style.BackColor = Color.LightGreen;
        }
    }
}
